const Model = {
  configs: {},

  extend: BaseClass => {
    class ModelClass extends BaseClass {
      global_domain(domain) {
        return super.global_domain(domain)
      }

      async channel_get(partners_to) {
        const res = await this.call('channel_get', [partners_to], {})
        return res
      }

      async private_message_post(channel_id, msg) {
        const kwargs = {
          message_type: 'comment',
          subtype: 'mail.mt_comment',
          body: msg
        }

        const res = await this.call('message_post', [channel_id], kwargs)
        // console.log('sssss,ss,', res)
        return res
      }

      async notify_typing(rid, is_typing) {
        const res = await this.call('notify_typing', [rid, is_typing], {})
        return res
      }

      async channel_fetch_message(rid, last) {
        const res = await this.call('channel_fetch_message', [rid, last], {})
        return res
      }

      async browse_one(rid, kwargs) {
        return await super.browse_one(rid, kwargs)
      }
    }
    return ModelClass
  }
}

export default Model
